package br.com.kallango.server.util;

import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.ObjectOutputStream;

import org.apache.mina.core.session.IoSession;

public class Utiul {

	/**
	 * Envia uma menssagem para o cliente
	 * @param session
	 * @param object
	 */
	public static void enviarMsgCliente(IoSession session, Object object) {
		
		ByteArrayOutputStream baos = new ByteArrayOutputStream();
		ObjectOutputStream oos;
		
		try {
			oos = new ObjectOutputStream(baos);
			oos.writeObject(object);
			session.write(baos.toByteArray());
		} catch (IOException e) {
			e.printStackTrace();
		}
	}
}
